package com.meilai.project.controller.web.business.customer;


import com.meilai.project.dto.base.ApiResult;
import com.meilai.project.service.business.customer.CustomerApplyFollowRecordService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author xhy
 * @since 2022-09-09
 */
@RestController
@RequestMapping("/api/web/customerApplyFollowRecord")
public class CustomerApplyFollowRecordController {

    @Autowired
    private CustomerApplyFollowRecordService service;

    @ApiModelProperty("申请跟进")
    @PostMapping("/apply")
    public ApiResult<Boolean> applyFollow(@RequestParam("customer_id") Long customer_id) {
        try {
            return ApiResult.ok(service.applyFollow(customer_id));
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResult.err("申请跟进失败");
        }
    }

    @ApiModelProperty("通过申请跟进")
    @PostMapping("/pass")
    public ApiResult<Boolean> pass(@RequestParam("id") Long id) {
        try {
            return ApiResult.ok(service.pass(id));
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResult.err("审核失败");
        }
    }

    @ApiModelProperty("驳回申请跟进")
    @PostMapping("/reject")
    public ApiResult<Boolean> reject(@RequestParam("id") Long id) {
        try {
            return ApiResult.ok(service.reject(id));
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResult.err("审核失败");
        }
    }
}
